<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/01.css">
    <link rel="stylesheet" href="css/02.css">
    <link rel="stylesheet" href="css/common.css">
    <style>
        #title{
            letter-spacing: 1.5px;
            padding: 10px 0px;
        }
        main{
            width:100%;
            height: 730px;
            background: url(img/bjbenchi.jpg)no-repeat;
            background-size: cover;
            opacity: 0.8;
          
        }
        
        main img{
            width:800px;
            height:520px;
            background-size: cover;
            padding-bottom: 20px;
        }
        main #con{
            width:800px;
            height: 730px;
            margin:0 auto;
          
            background: #d1d1d1;
        
        }
        #content{
            width: 800px;
            height: 100px;
           padding:5px 0px;
        }
        main h4{
            padding:10px;
            float: right;
        }
    </style>
    <script src="jquery.min.js"></script>
    <script>
        
                            $("#head .p1").html(sessionStorage.getItem("userinfor"))
                      
            // let url="http://10.35.161.25/detlist.html?id=2&sex=1"
           String.prototype.parseUrl= function (){
                let jiequ=this.slice(this.indexOf("?")+1) ;
              let arr=jiequ.split("&");
              let result={};
              arr.forEach(item=>{
                
                 let key= item.split("=")[0];
                 let value=item.split("=")[1];
                    result[key]=value;
                  
              })
           return result;
            }
          $.ajax({
              url:"http://127.0.0.1:8080/getnews?",
              data:{
                  id:location.href.parseUrl().id
              },
              success(data){
                  $("#title").html(data.name);
                  $("#price").html(data.price);
                  $("#img").attr("src",data.img)
                  $("#content").html(data.miaoshu);
                  console.log(data)
              }
          })
        </script>
    
    
    <!-- <link rel="stylesheet" href="css/common.css"> -->
  
    

</head>
<body>
    <header id="head"></header>
    
  <main >
      <div id="con">
            <h2 id="title">这是个大标题</h2>
            <hr>
            <h4>价格： <span id="price"></span></h4>
            <img src="" alt="" id="img" >
            <div id="content">
              
            </div>
      </div>
        
     
    
  </main>
   <div id="foot"></div>
    
</script>    
</body>
</html>
<script src="js/jquery.min.js"></script>
<!-- <script src="js/01.js"></script> -->
<script>
   
                            $("#head .p1").html(sessionStorage.getItem("userinfor"))
                     
    $('#head').load('head.html');
    $('#foot').load('foot.html');
</script>
  
